﻿@model DA.Role
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Edit</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Role</legend>
        @if (Model != null && Model.RoleId != 0)
        {
            @Html.HiddenFor(model => model.RoleId)
        }
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.RoleDescription)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RoleDescription)
            @Html.ValidationMessageFor(model => model.RoleDescription)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PermissionsString)
        </div>
        <div class="editor-field">
            <ul>
                @foreach (SelectListItem item in ViewBag.PermList)
                {
                    <li>
                        @Html.CheckBox("perm_" + item.Value, item.Selected)
                        @item.Text
                    </li>
                }
            </ul>
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
